home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / rexx / 2023 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.4 KB

  1. Path: zipper.zip.com.au!not-for-mail
  2. From: craig@zip.com.au (Craig Pardey)
  3. Newsgroups: comp.lang.rexx
  4. Subject: Re: How do I read from a file?
  5. Date: 17 Apr 1996 10:22:58 +1000
  6. Organization: Zip Australia Pty Ltd
  7. Distribution: inet
  8. Message-ID: <4l1dl2$7ta@zipper.zip.com.au>
  9. References: <4ktd9n$3qe@zipper.zip.com.au> <4kus4q$dvh@sam.inforamp.net>
  10. NNTP-Posting-Host: zipper.zip.com.au
  11. X-Newsreader: NN version 6.5.0 #5 (NOV)
  12.  
  13. >>I just need to know how to open, read from and close a file in rexx.  I have looked in the faq 
  14. >>and it's ot there.  Is there an easy way to pull a certain line from the file, or even certain 
  15. >>elements like there is in awk?
  16.  
  17. >Have you tried to use Rexx built-in functions like LineIn() LineOut()
  18. >CharIn() and CharOut(); whcih are used to perform file I/O.
  19.  
  20. >To read/write to a file:
  21.  
  22.  
  23. >MyFile  = "C:\CONFIG.SYS"
  24. >NewFile = "C:\CONFIG.BKP"
  25.  
  26. >Do While Lines(MyFile)            /* Continue reading until the end-of-file */
  27. >   InLine = LineIn(Myfile)         /* Reads from a file variable myfile      */
  28. >   Say InLine                      /* Display line read on the screen        */
  29. >   OutLine = LineOut(NewFile)    /* Writes to a file variable NeWfile      */
  30. >End
  31.  
  32. Thanx a lot.  I got it all working now :)
  33.  
  34. cheers,
  35. craig
  36.  
  37. -- 
  38. |    /===\/===\                 | "Better get a lawyer, Son"          |
  39. |    |   OO   |=============888 | "Better get a real good one."       |
  40. |    \===/\===/                 |   - Cruel Sea                       |
  41.  
  42.